home *** CD-ROM | disk | FTP | other *** search
/ Freelog 22 / freelog 22.iso / Prog / Djgpp / GPC2952B.ZIP / doc / gpc / docdemos / packeddemo.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2001-02-09  |  699 b   |  31 lines

  1. program PackedDemo;
  2.  
  3. type
  4.   MonthInt = packed 1 .. 12;  { needs one byte   }
  5.   FastMonthInt = 1 .. 12;     { needs four bytes }
  6.  
  7.   FixString10 = packed array [1 .. 10] of Char;
  8.   FoxyString10 = array [0 .. 9] of Char;
  9.  
  10.   Flags = packed array [1 .. 32] of Boolean;  { needs four Bytes }
  11.  
  12.   DateRec = packed record
  13.     Day: 1 .. 31;       { five bits }
  14.     Month: MonthInt;    { four bits }
  15.     Year: Integer (15)  { 15 bits = -16384 .. 16383 }
  16.   end;
  17.  
  18.   Dates = array [1 .. 1000] of DateRec;
  19.  
  20. var
  21.   S: FixString10;
  22.   T: FoxyString10;
  23.  
  24. begin
  25.   S := 'Hello!';   { blank padded }
  26.   WriteLn (S);
  27.  
  28.   T := 'GNU Pascal';  { GPC extension: this also works. }
  29.   WriteLn (T)
  30. end.
  31.